import { mount } from '@vue/test-utils'
import { set_test_config } from './utils'
import Block from './Block.vue'

test('Block mounting', async () => {
  await set_test_config()
  mount(Block, {
    props: {
      title: 'Block',
      block: {
        hash: "1fe0d0bb557f1a9057a2fca119566b439aa70d04918b71ea1485d5da2c7566b5",
        status: "confirmed",
        block: {
          header: {
            chainId: "aee928d4bf3880353b4a3cd9b6f88e6cc6e5ed050860abae439e7782e9b2dfe8",
            epoch: "0",
            height: 6,
            timestamp: 1694097511817833,
            authenticatedOwner: "a36c72207a7c3cef20eb254978c0947d7cf28c9c7d7c62de42a0ed9db901cf3f",
            previousBlockHash: "f1c748c5e39591125250e85d57fdeac0b7ba44a32c12c616eb4537f93b6e5d0a",
            stateHash: "5bcd40995283e74798c60e8dc7a93e8c61059440534070673dfb973b2b66f61a",
            transactionsHash: "5bcd40995283e74798c60e8dc7a93e8c61059440534070673dfb973b2b66f61a",
            messagesHash: "5bcd40995283e74798c60e8dc7a93e8c61059440534070673dfb973b2b66f61a",
            previousMessageBlocksHash: "5bcd40995283e74798c60e8dc7a93e8c61059440534070673dfb973b2b66f61a",
            previousEventBlocksHash: "5bcd40995283e74798c60e8dc7a93e8c61059440534070673dfb973b2b66f61a",
            eventsHash: "5bcd40995283e74798c60e8dc7a93e8c61059440534070673dfb973b2b66f61a",
            oracleResponsesHash: "5bcd40995283e74798c60e8dc7a93e8c61059440534070673dfb973b2b66f61a",
            blobsHash: "5bcd40995283e74798c60e8dc7a93e8c61059440534070673dfb973b2b66f61a",
            operationResultsHash: "5bcd40995283e74798c60e8dc7a93e8c61059440534070673dfb973b2b66f61a",
          },
          body: {
            messages: [[{
              destination: { Subscribers: [1] },
              authenticatedOwner: null,
              kind: "Protected",
              grant: 0,
              message: {
                System: {
                  BytecodeLocations: {
                    locations: [
                      [
                        "e476187f6ddfeb9d588c7b45d3df334d5501d6499b3f9ad5595cae86cce16a65020000000000000000000000",
                        { certificateHash: "a4167c67ce9c94c301fd5cbbefeccf6c8e56d568a4c75ed85e93bfacee66bac5", operation_index: 0 }],
                      [
                        "e476187f6ddfeb9d588c7b45d3df334d5501d6499b3f9ad5595cae86cce16a65050000000000000000000000",
                        { certificateHash: "f1c748c5e39591125250e85d57fdeac0b7ba44a32c12c616eb4537f93b6e5d0a", operation_index: 0 }]]
                  }
                }
              }
            }]],
            previousMessageBlocks: {},
            previousEventBlocks: {},
            events: [[]],
            oracleResponses: [],
            blobs: [[]],
            operationResults: [],
            transactionMetadata: [{
              transactionType: "ReceiveMessages",
              incomingBundle: {
                origin: {
                  medium: "Direct",
                  sender: "aee928d4bf3880353b4a3cd9b6f88e6cc6e5ed050860abae439e7782e9b2dfe8"
                },
                bundle: {
                  certificateHash: "f1c748c5e39591125250e85d57fdeac0b7ba44a32c12c616eb4537f93b6e5d0a",
                  height: 5,
                  messages: [{
                    authenticatedOwner: null,
                    message: { System: { BytecodePublished: { operation_index: 0 } } },
                    grant: "0.01",
                    index: 4,
                    kind: "Tracked",
                    messageMetadata: {
                      messageType: "System",
                      applicationId: null,
                      userBytesHex: null,
                      systemMessage: null
                    }
                  }],
                  transactionIndex: 0,
                  timestamp: 1694097510206912
                },
                action: "Accept",
              },
              operation: null
            }]
          }
        }
      }
    },
  })
})
